package com.dong.service;

import com.dong.bean.Person;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.transaction.annotation.Transactional;

public class PersonServiceImpl implements  PersonService {
    public PersonServiceImpl() {
        System.out.println();
    }

    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Override
    @Transactional
    public void Insert(Person person) {
        jdbcTemplate.execute("insert into person(name,age) values ('"+person.getName()+"',"+person.getAge()+")");
        System.out.println("插入完成");
        int i = 1/0;
    }
}
